$(function() {
		var contextPath = document.location.pathname;
		var index = contextPath.substr(1).indexOf("/");
		contextPath = contextPath.substr(1, index);
		var basePath = "/" + contextPath;
		changeValidateCode(this);
		
		
		var validObject = $("#inputUserForm").Validform({
			
			dataType:'json',
			tiptype:2,
			ajaxPost:true,
			
			callback:function(data){
				if(data.flag==1){
					var memberId = data.member.id;
					window.location.assign(basePath+"/HRTWEB/jumpToConfirmUser.do?memberId="+memberId);
				}
				else if(data.flag==2){
					var obj = document.getElementById("checkCode");
					changeValidateCode(obj);
				}
				else{
					
					var obj = document.getElementById("checkCode");
					changeValidateCode(obj);
				}
				
			},
			
			tiptype:function(msg,o,cssctl){
				
				if(!o.obj.is("form")){
					var tds=o.obj.text();
					
					var objtip=o.obj.siblings(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				
					
				}	
				
			}
		
		});
		/*var options = {
		dataType:'json',
		
        success: function (data) {
        	if(data.flag==1){
				var memberId = data.member.id;
				window.location.assign(basePath+"/HRTWEB/jumpToConfirmUser.do?memberId="+memberId);
			}
			else if(data.flag==2){
				alert("用户名输入错误");
				var obj = document.getElementById("checkCode");
				changeValidateCode(obj);
			}
			else{
				$("#codeTip").css("display","block");
				
				var obj = document.getElementById("checkCode");
				changeValidateCode(obj);
			}
        	
        }
    };*/
		
		/**
		 * 异步提交表单
		 */
		/*$("#inputUserForm").delegate('#forgetNext', 'click', function() {
			var text = $(".form_hint1").html();
			var hrtMemberCheckout = $("#hrtMemberCheckout").val();

			if(text=="用户名不存在,请重新输入" || (hrtMemberCheckout.length!=4)){
				
				$("#codeTip").css("display","block");
				
				return false;
			}
			else{
				
				$("#inputUserForm").ajaxSubmit(options);
			}
			
		});*/
		
	});


/**
 * 刷新
 */
function refresh() {
	window.location.reload();
}
	function changeValidateCode(obj) {
		var timeNow = new Date().getTime();
		obj.src ="../CheckCode.do?time=" + timeNow;

	} 